Skip to content

test(daemon): harden Vela workspace billing coverage - #6298

Closed
shangxinyu1 wants to merge 1 commit into
mainfrom
codex/vela-workspace-daemon-tests
Closed

test(daemon): harden Vela workspace billing coverage#6298
shangxinyu1 wants to merge 1 commit into
mainfrom
codex/vela-workspace-daemon-tests

Conversation

@shangxinyu1

Copy link
Copy Markdown
Contributor

概要

补齐 Vela Workspace 钱包、订阅、席位、成员邀请、自动充值及多 Workspace 隔离相关的 daemon 高价值测试,并加固对应代理边界。

主要变更

  • 扩充 Vela daemon 路由测试,覆盖:
    • 个人与 Team Workspace 钱包余额、套餐额度和叠加余额刷新
    • Personal / Team 套餐、订阅升级、取消后恢复及多 Workspace 隔离
    • 自动充值、账单、发票、成员邀请、席位变化与金额累计
    • 并发刷新、凭证轮换、过期控制密钥恢复和异常上游响应
    • Workspace 请求隔离、幂等键透传、流式请求中断和异常连接恢复
  • 新增钱包读取器单元测试,验证 TTL、强制刷新、非法余额及 malformed JSON 的降级行为。
  • 加固 Vela API 代理:
    • 仅允许 /api/v1/* 上游路径
    • 校验 x-vela-workspace-id
    • 过滤请求和响应中的 hop-by-hop headers
    • 客户端断开时终止上游请求
  • 钱包接口拒绝负数、NaN、Infinity、数值类型等非法 balanceUsd,并保留最近一次有效快照。
  • 修复 daemon 全量测试中的 4 个不稳定项:
    • Fake Claude 支持新增的 auth status 预检
    • 为确实需要反复启停 daemon 的慢测设置局部 timeout

影响

提升 Workspace 账单与钱包边界的回归覆盖,防止不同 Workspace 的余额、凭证、请求状态相互污染,同时让代理在断连、非法 header 和异常上游数据下保持安全、可恢复。

验证

  • Vela daemon focused tests:117/117 通过
  • 原失败的 4 个测试文件:38/38 通过
  • pnpm --filter @open-design/daemon typecheck
  • pnpm guard
  • git diff --check

@lefarcen
lefarcen requested a review from PerishCode July 31, 2026 04:56
@lefarcen lefarcen added size/XXL PR changes 1500+ lines risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps type/bugfix Bug fix labels Jul 31, 2026
@AmyShang-alt

Copy link
Copy Markdown
Contributor

Closed: this draft PR was created from the wrong local repository/worktree. The intended work belongs in powerformer/vela and will be recreated there with local gh.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

risk/high High risk: apps/desktop, daemon, auth, migration, workflows, package deps size/XXL PR changes 1500+ lines type/bugfix Bug fix

Projects

None yet

Development

Successfully merging this pull request may close these issues.

3 participants